-
Notifications
You must be signed in to change notification settings - Fork 7
Moments method #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moments method #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the M-step of the EM algorithm using the method of moments for Weibull, Exponential, and Gaussian distributions, providing an alternative to maximum likelihood estimation.
- Implementation of
MomentsMStepclass for parameter estimation using sample moments - Addition of
calc_moments_paramsmethods to distribution models (Weibull, Gaussian, Exponential) - Comprehensive test suite covering single distributions, same distribution mixtures, and mixed distribution scenarios
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
mpest/em/methods/moments_method.py |
Core implementation of moments-based M-step algorithm |
mpest/models/weibull.py |
Addition of moments-based parameter calculation for Weibull distribution |
mpest/models/gaussian.py |
Addition of moments-based parameter calculation for Gaussian distribution |
mpest/models/exponential.py |
Addition of moments-based parameter calculation for Exponential distribution |
tests/tests_moments/moments_utils.py |
Utility functions for moments method testing |
tests/tests_moments/test_*.py |
Comprehensive test suite for moments method validation |
examples/*.py |
Minor import ordering adjustments for consistency |
Comments suppressed due to low confidence (3)
tests/tests_moments/test_two_same_distributions_complex.py:103
- Function name
test_two_same_distributions_simpleis misleading as this test handles complex scenarios with custom prior probabilities, not simple ones.
def test_two_same_distributions_simple(
tests/tests_moments/test_any_distributions_simple.py:67
- Function name
testis too generic and doesn't describe what the test is actually testing. It should be renamed to something more descriptive liketest_any_distributions_simple.
def test(
tests/tests_moments/test_any_distributions_complex.py:78
- Function name
testis too generic and doesn't describe what the test is actually testing. It should be renamed to something more descriptive liketest_any_distributions_complex.
def test(
iraedeus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical error in tests, you have tested LMoments method, not Moments method.
Implementation of the M step of the EM algorithm using the method of moments for Weibull, Exponential and Gaussian distributions